module AASM
  module SupportingClasses
    class State
      attr_reader :description

      def initialize(name, options={})
        @name, @options = name, options
        @description = @options[:description]
      end

    end
  end

  module ClassMethods
    def aasm_include_state?(name)
      case name
      when Symbol then
        aasm_states.any? {|state| state.name == name}
      when String then
        aasm_states.any? {|state| state.name.to_s == name}
      end
    end
  end

  def aasm_current_state_description
    aasm_state_object_for_state(aasm_current_state).description
  end

end
